/**
 * Created by Richard Radlherr.
 * Date: 15.07.2006 18:44
 */

using System;

namespace TagTool.GraphicTypes
{
	[Serializable()]
	public class Rectangle : Shape
	{
		private double width = 1.0;
		private double height = 1.0;
		
		private Color color = new Color(1.0, 1.0, 1.0, 1.0);
		
		public Rectangle()
		{
		}
		
		protected override void Compile()
		{
			double a = width / 2;
			double b = height / 2;
			glBegin(GL_QUADS);
			glColor4d(color.R, color.G, color.B, color.A);
			glVertex3d(-a, -b, 0.0);
			glVertex3d(a, -b, 0.0);
			glVertex3d(a, b, 0.0);
			glVertex3d(-a, b, 0.0);
			glEnd();
		}

		public double Width
		{
			get { return width; }
			set 
			{
				width = value; 
				Update();
			}
		}
		
		public double Height
		{
			get { return height; }
			set 
			{ 
				height = value; 
				Update();
			}
		}
		
		public Color Color
		{
			get { return color; }
			set 
			{ 
				color = value;
				Update();
			}
		}
		

	}
}
